package com.cskaoyan.exceptionHandler;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.exeception.DateFormatException;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
public class ExceptionControllerAdvice {

    @ExceptionHandler(DateFormatException.class)
    public BaseRespVo dateFormatException() {
        return BaseRespVo.fail("日期格式输入错误");
    }

    @ExceptionHandler(AuthorizationException.class)
    public BaseRespVo authorizationException() {
        return BaseRespVo.fail(602,"你没有权限进入该模块");
    }
}
